/**
 * Created by Administrator on 2017/3/2 0002.
 */
var Game={
    create:function () {
        var game={};
        var arr_circle=[];
        game.ui=new PIXI.DisplayObjectContainer();

        var pageSound=PageListen.create();
        var page0=Page0.create();
        var page1=Page1.create();
        var bt_music=Easy.CreateSprite('assets/images/bt_music.png',650,54,0.5,0.5,1);
        bt_music.alpha=1;
        bt_music.interactive=true;
        bt_music.on('pointerdown',musicHandler);
        var tw=TweenMax.to(bt_music.scale,1,{repeat:-1,yoyo:true,x:0.9,y:0.9,ease:Cubic.easeInOut});

        // page0.In()
        // game.ui.addChild(page0.ui);
        pageSound.In()
        game.ui.addChild(pageSound.ui);
        game.ui.addChild(bt_music);

        document.addEventListener('Game_PageIn',pageInHandler)

        function musicHandler(e)
        {
            if(bt_music.alpha>0.95)
            {
                tw.pause();
                bt_music.alpha=0.9;
                volumeChange(0);
            }
            else
            {
                bt_music.alpha=1;
                tw.resume();
                volumeChange(1);
            }
        }

        function pageInHandler(e)
        {
            if(e.detail=='0')
            {
                game.ui.addChild(page0.ui);
                page0.In();
            }
            else if(e.detail=='1')
            {
                 game.ui.addChild(page1.ui);
                 page1.In();
            }

        }

        return game;
    }

}